﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.ComponentModel.Composition;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Core.DataAccess;
using SonCa.SocialNetwork.Accounts.IPresenters;
using SonCa.SocialNetwork.Accounts.Presenters;

namespace SonCa.SocialNetwork.Accounts
{
    public partial class Register : System.Web.UI.Page, IRegister
    {
        private RegisterPresenter _presenter;
        protected void Page_Load(object sender, EventArgs e)
        {
            _presenter = new RegisterPresenter();
            _presenter.Init(this);
        }

        public void ShowErrorMessage(string Message)
        {

        }

        public void LoadreCaptchaSetting(bool value)
        {
           
        }

        protected void btnRegister_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                DateTime birthDate = string.IsNullOrEmpty(txtBirthDate.Text) ? DateTime.MinValue : Convert.ToDateTime(txtBirthDate.Text);
                _presenter.Register(txtUsername.Text, txtPassword.Text, txtLastName.Text, txtMiddleName.Text, txtFirstName.Text, txtEmail.Text, birthDate, Page.IsValid, true, 0);
            }
        }
    }
}